<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<jsp:include page="/common/meta.jsp"></jsp:include>
<jsp:include page="/common/css_js.jsp"></jsp:include>
<script>
$(document).ready(
		function() {
			//聚焦第一个输入框
			$("#name").focus();
			//为inputForm注册validate函数
			$("#inputForm")
					.validate(
							{
								rules : {
									name : {
										required : true,
										isResourcesName : true,
										maxlength : 255,
										remote : "resources!checkResourceName.action?oldRoleName="+ encodeURIComponent('${name}')
									},
									resources : {
										isResourcesAddres : true,
										required : true,
										maxlength : 255
									}
								},
								messages : {
									name : {
										isResourcesName : "资源标识输入有误,格式为: xx_xx", 
										required : "资源标识不能为空",
										maxlength : "长度太长了",
										remote : "资源标识已存在"
									},
									resources : {
										isResourcesAddres : "资源地址格式有误,格式为: .action结尾",
										required : "资源地址不能为空",
										maxlength : "长度太长了"
									}
								}
							});
		});
</script>
</head>

<body>
	<s:if test="id == null">
		<jsp:include page="/common/content_top.jsp"><jsp:param name="title" value="新增资源"/></jsp:include>
	</s:if>
	<s:else>
		<jsp:include page="/common/content_top.jsp"><jsp:param name="title" value="修改资源"/></jsp:include>
	</s:else>
	<br/>
	<form id="inputForm" action="resources!save.action" method="post">
		<input type="hidden" name="id" value="${id}" />
		<table border="0" style="margin-left: 30px;">
			<tr>
				<td align="right">资源标识:</td>
				<td><input type="text" name="name" size="40"
					id="name" value="${name}" />
				</td>
			</tr>			
			<tr>
				<td align="right">资源地址:</td>
				<td><input type="text" id="resources" name="resources" size="40"
					id="name" value="${resources}" />
				</td>
			</tr>
			<tr>
				<td colspan="2" align="center"><security:authorize ifAnyGranted="resources_update">
						<input class="button" type="submit" value="提交" />&nbsp;
					</security:authorize> <input class="button" type="button" value="返回"
					onclick="history.back()" /></td>
			</tr>
		</table>
	</form>
<jsp:include page="/common/content_bottom.jsp"/>
</body>
</html>
